#-------------------------------------------------
#
# Project created by QtCreator 2020-06-11T13:45:26
#
#-------------------------------------------------

QT       += core widgets printsupport

TARGET = peony-print-pictures

DEFINES += AS_PLUGIN
if(contains(DEFINES, AS_PLUGIN)){
    message('打包成动态库')
    TEMPLATE = lib
    CONFIG += plugin
}else{
    message('打包成APP')
    TEMPLATE = app
}

DEFINES += PEONYPRINTPICTURES_LIBRARY

# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

CONFIG += debug link_pkgconfig plugin

#PKGCONFIG += peony gsettings-qt
INCLUDEPATH += "/usr/include/peony-qt"
PKGCONFIG += gsettings-qt gio-2.0
TRANSLATIONS = translations/peony-print-pictures-extension_zh_CN.ts \
               translations/peony-print-pictures-extension_tr.ts

#DESTDIR += ../testdir
INCLUDEPATH += $$PWD
DISTFILES += $$PWD/common.json

SOURCES += \
    print-pictures-plugin.cpp \
    custom_log.cpp

HEADERS += \
        print-pictures-plugin.h \
        peony-print-pictures_global.h \
        custom_log.h

if(contains(DEFINES, AS_PLUGIN)){
    message('无main文件')
}else{
    message('有main文件')
    SOURCES += main.cpp
}


unix {
    if(contains(DEFINES, AS_PLUGIN)){
        message('复制到peony插件库文件夹')
        target.path = $$[QT_INSTALL_LIBS]/peony-extensions
        INSTALLS += target
    }else{
        message('可执行文件复制到/usr/bin/')
        target.path = /usr/bin/
        target.source += $$TARGET
        INSTALLS += target
    }
}

translationsFiles.path = /usr/share/peony-print-pictures/translations/
translationsFiles.files += $$PWD/translations/*.qm
INSTALLS += translationsFiles

RESOURCES += \
    peony-print-pictures.qrc
